package com.slz3.business.module.configManagement.conSiteCity.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConSiteCityFactory {

    /**
     * 初始化基础属性值
     */
    public static ConSiteCity initBaseFields(ConSiteCity conSiteCity) {
        if (conSiteCity.getUuid() == null) {
            conSiteCity.setUuid(UUIDUtils.generateUUID());
            conSiteCity.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conSiteCity.getSerAudit())) {
                conSiteCity.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conSiteCity.getSerUsing())) {
                conSiteCity.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conSiteCity.setLastModifyTime(LocalDateTime.now());
        }
        return conSiteCity;
    }

    /**
     * 初始化基础属性值
     */
    public static ConSiteCity initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConSiteCity newTemStyle() {
        return new ConSiteCity();
    }

}
